package com.company.project.controller.ldjsc.home;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.company.project.entity.ldjsc.home.CockpitContentEntity;
import com.company.project.entity.ldjsc.home.JscJcbgXqEntity;
import com.company.project.service.ldjsc.home.CockpitContentService;
import com.company.project.service.ldjsc.home.JscJcbgXqService;
import org.apache.commons.collections.list.AbstractLinkedList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import java.util.*;

import com.company.project.common.utils.DataResult;




/**
 *
 *
 * @author wenbin
 * @email *****@mail.com
 * @date 2025-08-11 18:08:24
 */
@Controller
@RequestMapping("/sxzy")
public class CockpitContentController {
    @Autowired
    private CockpitContentService cockpitContentService;

    @Autowired
    private JscJcbgXqService jscJcbgXqService;


    @ApiOperation(value = "监测报告-列表")
    @GetMapping("/jsc-dd-zt/JscJcbgLb2")
    @ResponseBody
    public DataResult JscJcbgLb2(JscJcbgXqEntity jscJcbgXqEntity){


        //jsc_jcbg_xq表列表
        LambdaQueryWrapper<JscJcbgXqEntity> queryWrapper = Wrappers.lambdaQuery();
        //查询条件示例
        if (jscJcbgXqEntity.getMidgard_offset() != null){
            jscJcbgXqEntity.setMidgard_page(1);
        }
        queryWrapper.orderByDesc(JscJcbgXqEntity::getCreate_time);
        IPage<JscJcbgXqEntity> iPage = jscJcbgXqService.page(jscJcbgXqEntity.getQueryPage(), queryWrapper);
        List<JscJcbgXqEntity> records = iPage.getRecords();



        //cockpit_content表列表
//        LambdaQueryWrapper<CockpitContentEntity> queryWrapper = Wrappers.lambdaQuery();
//        //查询条件示例
//        if (cockpitContent.getMidgard_offset() != null){
//            cockpitContent.setMidgard_page(1);
//        }
//        queryWrapper.orderByDesc(CockpitContentEntity::getCreate_time);
//        IPage<CockpitContentEntity> iPage = cockpitContentService.page(cockpitContent.getQueryPage(), queryWrapper);
//        List<CockpitContentEntity> records = iPage.getRecords();


        List<String> columnNames = Arrays.asList(
                "id",
                "title",
                "source_from",
                "content_url",
                "image_url",
                "vedio_url",
                "state",
                "create_time",
                "creator",
                "update_user",
                "update_time",
                "publish_time",
                "publisher",
                "type_code",
                "type_name",
                "dept_name",
                "dept_code",
                "index_code",
                "index_name",
                "month",
                "type_id",
                "show_main_page",
                "prefix_title",
                "is_new",
                "new_sq",
                "main_sq",
                "type_sq",
                "sort"
        );

        Map<String, Object> result = new HashMap<>();
        result.put("columnNames", columnNames);
        result.put("value", records);

        return DataResult.success(result);
    }


    @ApiOperation(value = "监测报告-经济运行")
    @GetMapping("/jsc-dd-zt/JscJcbgJJyx2")
    @ResponseBody
    public DataResult JscJcbgJJyx2(){
        //查询条件示例
        CockpitContentEntity cockpitContentEntity = cockpitContentService.selectByPrefixTitle();
        List<String> columnNames = Arrays.asList(
                "id",
                "title",
                "source_from",
                "content_url",
                "image_url",
                "vedio_url",
                "state",
                "create_time",
                "creator",
                "update_user",
                "update_time",
                "publish_time",
                "publisher",
                "type_code",
                "type_name",
                "dept_name",
                "dept_code",
                "index_code",
                "index_name",
                "month",
                "type_id",
                "show_main_page",
                "prefix_title",
                "is_new",
                "new_sq",
                "main_sq",
                "type_sq",
                "sort"
        );

        Map<String, Object> result = new HashMap<>();
        result.put("columnNames", columnNames);
        result.put("value", cockpitContentEntity);

        return DataResult.success(result);
    }

    @ApiOperation(value = "监测报告-国资动态")
    @GetMapping("/jsc-dd-zt/JscJcbgGzdt2")
    @ResponseBody
    public DataResult JscJcbgGzdt2(){
        //查询条件示例
        CockpitContentEntity cockpitContentEntity = cockpitContentService.selectByIndexName();
        List<String> columnNames = Arrays.asList(
                "id",
                "title",
                "source_from",
                "content_url",
                "image_url",
                "vedio_url",
                "state",
                "create_time",
                "creator",
                "update_user",
                "update_time",
                "publish_time",
                "publisher",
                "type_code",
                "type_name",
                "dept_name",
                "dept_code",
                "index_code",
                "index_name",
                "month",
                "type_id",
                "show_main_page",
                "prefix_title",
                "is_new",
                "new_sq",
                "main_sq",
                "type_sq",
                "sort"
        );

        Map<String, Object> result = new HashMap<>();
        result.put("columnNames", columnNames);
        result.put("value", cockpitContentEntity);

        return DataResult.success(result);
    }


    @ApiOperation(value = "五应五不")
    @GetMapping("/jsc-dd-zt/JscWywb2")
    @ResponseBody
    public DataResult JscWywb2(){
        //查询条件示例
        List<CockpitContentEntity> cockpitContentEntity = cockpitContentService.selectByTitle();


        List<String> columnNames = Arrays.asList(
                "id",
                "title",
                "source_from",
                "content_url",
                "image_url",
                "vedio_url",
                "state",
                "create_time",
                "creator",
                "update_user",
                "update_time",
                "publish_time",
                "publisher",
                "type_code",
                "type_name",
                "dept_name",
                "dept_code",
                "index_code",
                "index_name",
                "month",
                "type_id",
                "show_main_page",
                "prefix_title",
                "is_new",
                "new_sq",
                "main_sq",
                "type_sq",
                "sort"
        );

        Map<String, Object> result = new HashMap<>();
        result.put("columnNames", columnNames);
        result.put("value", cockpitContentEntity);

        return DataResult.success(result);
    }


    /**
     *文章数据
     */
    @ApiOperation(value = "文章数据-列表")
    @GetMapping("/jsc-dd-zt/JscWzsjLb2")
    @ResponseBody
    public DataResult JscWzsjLb2(CockpitContentEntity cockpitContent){
        LambdaQueryWrapper<CockpitContentEntity> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(CockpitContentEntity::getIndex_name, cockpitContent.getIndex_name());
        queryWrapper.eq(CockpitContentEntity::getSource_from, cockpitContent.getSource_from());
        queryWrapper.orderByDesc(CockpitContentEntity::getPublish_time);
        //查询条件示例
        if (cockpitContent.getMidgard_offset() != null){
            cockpitContent.setMidgard_page(1);
        }
        IPage<CockpitContentEntity> iPage = cockpitContentService.page(cockpitContent.getQueryPage(), queryWrapper);
        List<CockpitContentEntity> records = iPage.getRecords();
        List<String> columnNames = Arrays.asList(
                "id",
                "title",
                "source_from",
                "content_url",
                "image_url",
                "vedio_url",
                "state",
                "create_time",
                "creator",
                "update_user",
                "update_time",
                "publish_time",
                "publisher",
                "type_code",
                "type_name",
                "dept_name",
                "dept_code",
                "index_code",
                "index_name",
                "month",
                "type_id",
                "show_main_page",
                "prefix_title",
                "is_new",
                "new_sq",
                "main_sq",
                "type_sq",
                "sort"
        );

        Map<String, Object> result = new HashMap<>();
        result.put("columnNames", columnNames);
        result.put("value", records);

        return DataResult.success(result);
    }


    /**
     *文章数据
     */
    @ApiOperation(value = "文章数据-详情")
    @GetMapping("/jsc-dd-zt/JscWzsjXq2")
    @ResponseBody
    public DataResult JscWzsjXq2(CockpitContentEntity cockpitContent){
        LambdaQueryWrapper<CockpitContentEntity> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(CockpitContentEntity::getId, cockpitContent.getId());
        queryWrapper.orderByDesc(CockpitContentEntity::getPublish_time);
        //查询条件示例
        if (cockpitContent.getMidgard_offset() != null){
            cockpitContent.setMidgard_page(1);
        }
        IPage<CockpitContentEntity> iPage = cockpitContentService.page(cockpitContent.getQueryPage(), queryWrapper);
        List<CockpitContentEntity> records = iPage.getRecords();
        List<String> columnNames = Arrays.asList(
                "id",
                "title",
                "source_from",
                "content_url",
                "image_url",
                "vedio_url",
                "state",
                "create_time",
                "creator",
                "update_user",
                "update_time",
                "publish_time",
                "publisher",
                "type_code",
                "type_name",
                "dept_name",
                "dept_code",
                "index_code",
                "index_name",
                "month",
                "type_id",
                "show_main_page",
                "prefix_title",
                "is_new",
                "new_sq",
                "main_sq",
                "type_sq",
                "sort"
        );

        Map<String, Object> result = new HashMap<>();
        result.put("columnNames", columnNames);
        result.put("value", records);

        return DataResult.success(result);
    }


    /**
     * 监测报告
     */
    @ApiOperation(value = "监测报告")
    @GetMapping("/jsc-dd-zt/JscJcbg2")
    @ResponseBody
    public DataResult JscJcbg2(CockpitContentEntity cockpitContent){
        LambdaQueryWrapper<CockpitContentEntity> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(CockpitContentEntity::getIndex_name, cockpitContent.getIndex_name());
        queryWrapper.orderByDesc(CockpitContentEntity::getPublish_time);
        //查询条件示例
        if (cockpitContent.getMidgard_offset() != null){
            cockpitContent.setMidgard_page(1);
        }
        IPage<CockpitContentEntity> iPage = cockpitContentService.page(cockpitContent.getQueryPage(), queryWrapper);
        List<CockpitContentEntity> records = iPage.getRecords();
        List<String> columnNames = Arrays.asList(
                "id",
                "title",
                "source_from",
                "content_url",
                "image_url",
                "vedio_url",
                "state",
                "create_time",
                "creator",
                "update_user",
                "update_time",
                "publish_time",
                "publisher",
                "type_code",
                "type_name",
                "dept_name",
                "dept_code",
                "index_code",
                "index_name",
                "month",
                "type_id",
                "show_main_page",
                "prefix_title",
                "is_new",
                "new_sq",
                "main_sq",
                "type_sq",
                "sort"
        );

        Map<String, Object> result = new HashMap<>();
        result.put("columnNames", columnNames);
        result.put("value", records);

        return DataResult.success(result);
    }

    /**
     * 监测报告
     */
    @ApiOperation(value = "监测报告-详情")
    @GetMapping("/jsc-dd-zt/JscJcbgXq2")
    @ResponseBody
    public DataResult JscJcbgXq2(CockpitContentEntity cockpitContent){
        LambdaQueryWrapper<CockpitContentEntity> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(CockpitContentEntity::getId, cockpitContent.getId());
        queryWrapper.orderByDesc(CockpitContentEntity::getPublish_time);
        //查询条件示例
        if (cockpitContent.getMidgard_offset() != null){
            cockpitContent.setMidgard_page(1);
        }
        IPage<CockpitContentEntity> iPage = cockpitContentService.page(cockpitContent.getQueryPage(), queryWrapper);
        List<CockpitContentEntity> records = iPage.getRecords();
        List<String> columnNames = Arrays.asList(
                "id",
                "title",
                "source_from",
                "content_url",
                "image_url",
                "vedio_url",
                "state",
                "create_time",
                "creator",
                "update_user",
                "update_time",
                "publish_time",
                "publisher",
                "type_code",
                "type_name",
                "dept_name",
                "dept_code",
                "index_code",
                "index_name",
                "month",
                "type_id",
                "show_main_page",
                "prefix_title",
                "is_new",
                "new_sq",
                "main_sq",
                "type_sq",
                "sort"
        );

        Map<String, Object> result = new HashMap<>();
        result.put("columnNames", columnNames);
        result.put("value", records);

        return DataResult.success(result);
    }


}
